package com.example.mybatisstudy1.config;

import com.example.mybatisstudy1.redis.RedisCache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

@Configuration
public class MyBatisRedisCacheConfig {

    private final RedisTemplate<String, Object> redisTemplate;

    public MyBatisRedisCacheConfig(RedisTemplate<String, Object> redisTemplate) {
        System.out.println("aaaaaaaaaaaa");
        this.redisTemplate = redisTemplate;
    }

    @Bean
    public void initRedisCache() {
        System.out.println("bbbbbbbbb");
        // 将 RedisTemplate 设置到 RedisCache 中
        RedisCache.setRedisTemplate(redisTemplate);
    }
}
